<!DOCTYPE html>
<html>
<head>
    <title>JSONP测试</title>
    <meta charset="utf-8"/>
    <script src="../../js/jquery-1.10.1.min.js"></script>
    <script src="../../js/json2.js"></script>
    <script>
           $(function(){
                $(document).on("click", "#testBtn", function(){
                    $.ajax({
                        type : "post",
                        asnc: false,
                        cache:false,
                        data:"appId=1",
                        url : "http://localhost:8043/urcwebservice30/controller/jsonp?appId=22",
//                        url : "http://localhost:5656/?appId=" + appId,
                        timeout: 2000,
                        dataType : "jsonp",//数据类型为jsonp
                        jsonp: "jsonpCallback",//服务端用于接收callback调用的function名的参数
                        success : function(data){
                            alert("success:" + JSON.stringify(data));
                        },
                        error:function(data){
                           alert("Error:" + JSON.stringify(data));
                        }
                    });
                });
           });

    </script>
</head>
<body>
   <button id="testBtn">Test</button>
</body>
</html>